Ext.define("AmpleHarvest.DATA.Model.cPermissions", 
{
    extend: 'Ext.data.Model',
    proxy			:
	{
		simpleSortMode	: true,
		type			: 'ajax',
		url				: obj_config.C_STR_EXTERNAL_PATH+'/rest/permissions/status.php',
		reader			:
		{
			type			: 'json',
			root			: 'data'
		}
	},
    fields: 
    [
    	{name: 'C_STR_PERMISION_SAVED_QUERY_ADD',			type: 'boolean'},
        {name: 'C_STR_PERMISION_SAVED_QUERY_VIEW',  		type: 'boolean'},
        {name: 'C_STR_PERMISION_SAVED_QUERY_DELETE',		type: 'boolean'},
        {name: 'C_STR_PERMISION_SAVED_QUERY_EDIT',  		type: 'boolean'},
        {name: 'C_STR_PERMISION_STATISTICS_VIEW',  			type: 'boolean'},
        {name: 'C_STR_PERMISION_HR_SUBMIT',					type: 'boolean'},
        {name: 'C_STR_PERMISION_HR_VIEW_ALL',  				type: 'boolean'},        
        {name: 'C_STR_PERMISION_HR_EDIT_OWN_STAGE1',		type: 'boolean'},
        {name: 'C_STR_PERMISION_HR_EDIT_OWN_STAGE2', 		type: 'boolean'},
        {name: 'C_STR_PERMISION_HR_EDIT_ALL_STAGE1', 		type: 'boolean'},
        {name: 'C_STR_PERMISION_HR_EDIT_ALL_STAGE2', 		type: 'boolean'},
        {name: 'C_STR_PERMISION_HR_REQUEST_DEACTIVATE_OWN', type: 'boolean'},
        {name: 'C_STR_PERMISION_HR_REQUEST_DEACTIVATE_ALL', type: 'boolean'},
        {name: 'C_STR_PERMISION_HR_DEACTIVATE', 			type: 'boolean'},
        {name: 'C_STR_PERMISION_HR_VIEW_DISCUSSIONS', 		type: 'boolean'},
        {name: 'C_STR_PERMISION_HR_EDIT_DISCUSSIONS', 		type: 'boolean'},
        {name: 'C_STR_PERMISION_HR_EDIT_STATUS', 			type: 'boolean'},
        {name: 'C_STR_PERMISION_GROUP_REQUEST', 			type: 'boolean'},
        {name: 'C_STR_PERMISION_GROUP_APPROVE', 			type: 'boolean'},
        {name: 'C_STR_PERMISION_GROUP_EDIT', 				type: 'boolean'},
        {name: 'C_STR_PERMISION_GROUP_VIEW_INFO', 			type: 'boolean'},
        {name: 'C_STR_PERMISION_GROUP_VIEW_PENDING', 		type: 'boolean'},
        {name: 'C_STR_PERMISION_DATA_ADD', 					type: 'boolean'},
        {name: 'C_STR_PERMISION_DATA_DELETE', 				type: 'boolean'},
        {name: 'C_STR_PERMISION_ADMIN_VIEW', 				type: 'boolean'},
        {name: 'C_STR_PERMISION_ADMIN_VIEW_STATUS', 		type: 'boolean'},
        {name: 'C_STR_PERMISION_COMMENTING_ALL_CRUD',		type: 'boolean'}
     ],
     loadPermissions	: function(str_id, obj_caller, callback)
 	{
    	var cb = callback;
    	var caller = obj_caller;
 		this.proxy.extraParams = { p : str_id };
 		AmpleHarvest.DATA.Model.cPermissions.load(null,
    			{
    				success	: function(record, operation)
    				{
    					cb(record, caller);
    				}
 		// TODO : add a failure 
    			});
 	}
});